<?php

class ParamManager {
	public $params;

	// Constructor
	public function __construct() {
		$this->params = array();
	}

	// Returns whether the data is set or not
	public function is_set($data) {
		if($this->get($data) !== false) {
			return true;
		}
		return false;
	}

	// set a new data/value pair
	public function set($data, $value) {
		$this->params[$data] = $value;
	}

	// get a data's value, returns false if the data does not exist
	public function get($needle) {
		foreach($this->params as $data => $value) {
//			echo "testing($data,$value)\n";
			if(!strcmp($needle, $data)) {
				return $value;
			}
		}

		return false;
	}

	// del a specified data
	public function del($data) {
		echo "todo";
	}

	// load up the passed in parameter string
	public function init($params, $delim) {
//		echo "[ph] = '$params'\n";

		$parts = explode($delim, $params);
		foreach($parts as $next) {
			$pair = explode("=", $next);
			$this->set($pair[0], $pair[1]);
		}

//		print_r($this->params);
	}

	// clear out the currently stored data
	public function clear() {
		$this->params = array();
	}
}

?>
